import book.BookList;
import user.AdminUser;
import user.OrdinarylUser;
import user.User;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DickYang
 * 图书管理系统
 * Date: 2023-05-28
 * Time: 10:38
 */
public class Test {
    public static User login() {
        System.out.println("请输入你的姓名:");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("请输入你的身份: 1->管理员  0->普通用户");
        int chiose = scanner.nextInt();
        if (chiose == 1) {
            return new AdminUser(name);
        }else {
            return new OrdinarylUser(name);
        }
    }
    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = login();
        while(true) {
            int chiose = user.menu();
            //根据chiose返回的值调用对象中的不同的功能
            user.doWork(chiose,bookList);
        }
    }
}
